As a conventional encoder, for example, there is known an optical encoder described in Patent document 1. Namely, this optical encoder comprises an optical scale on which a plurality of latticed windows, constituted by different types of diffraction gratings, are arranged at predetermined intervals, and a two-dimensional image sensor. When this optical scale is irradiated with light, the two-dimensional image sensor picks up a pattern of light diffracted by the latticed window. Then, the optical encoder identifies the latticed window based on the picked-up diffracted light pattern and identifies a position of the latticed window in the moving direction of the optical scale based on the position of the diffracted light pattern in the image to detect an absolute position of a target to be measured.
Patent document 1: Japanese Examined Patent Publication No. H08-10145